﻿// reference http://www.codeproject.com/KB/aspnet/test-with-vs-devserver-2.aspx
// Date: Oct 02 2010
// Author: Sky Sanders (http://skysanders.net/subtext)
// License: public domain - attribution and link love appreciated

// If Visual Studio development server serves your needs capably, this is the leanest
// self hosting server around.

// For a more robust development server see http://cassinidev.codeplex.com

using System.Net;
using NUnit.Framework;

namespace Salient.Excerpts
{
    /// <summary>
    /// This is an example of controlling an out of process instance of 
    /// WebDeb.WebServer.  There may be some cases where this would be
    /// a desired course of action but typically the in process WebHostServer
    /// which uses directly the core WebDeb.WebHost assembly will provide
    /// a better experience.
    /// </summary>
    [TestFixture]
    public class WebDevServerFixture : WebDevServer
    {
        [TestFixtureSetUp]
        public void TestFixtureSetUp()
        {
           

            
#if NET2FX2
            const string site="TestSite.Fx20Vs08";
#endif

#if NET4FX4
            const string site="TestSite.Fx40Vs10";
#endif

            StartServer(@"..\..\..\" + site);

            // is the equivalent of
            // StartServer(@"..\..\..\..\TestSite",
            //    GetAvailablePort(8000, 10000, IPAddress.Loopback, true), 
            // "/", "localhost");
        }
        [TestFixtureTearDown]
        public void TestFixtureTearDown()
        {
            StopServer();
        }

        [Test]
        public void Test()
        {
            string html = new WebClient().DownloadString(NormalizeUri("Default.aspx"));
        }
    }
}